<?php

/* 自动加载目录下的widget文件，再批量注册widget,兼容dux */
add_action('widgets_init', 'unregister_d_widget');

function unregister_d_widget(){
    unregister_widget('WP_Widget_Search');
    unregister_widget('WP_Widget_Recent_Comments');
}

$widgets = array(
	// 'sticky',
	// 'statistics',
	// 'ads',
	// 'textads',
	// 'comments',
	 'posts',
	// 'readers',
	// 'tags'
);

foreach ($widgets as $widget) {
	include 'widget-'.$widget.'.php';
}

add_action( 'widgets_init', 'widget_ui_loader' );
function widget_ui_loader() {
	global $widgets;
	foreach ($widgets as $widget) {
		register_widget( 'widget_ui_'.$widget );
	}
}

//加载royal的widgets
include 'royal-widgets.php';

